﻿@model XichLoGreen.Models.NewsModel
@using XichLoGreen.Models;
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="@Url.Content("~/Content/GreenNews.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/GreenNews.js")"></script>
<script src="@Url.Content("~/Scripts/edit.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/JqueryUI/jquery-1.9.1.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/JqueryUI/jquery-ui-1.10.3.custom.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Scripts/JqueryUI/jquery.ui.theme.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Scripts/JqueryUI/jquery-ui.css")" rel="stylesheet" type="text/css" />

<script type ="text/javascript">
    $(document).ready(function () {
        //Title
        $("#Title").change(function () {
            var value = $(this).val();
            if (value == "") {
                
                $(this).css('background-color', 'pink');
            }
            
        });

        //Content
        //$("#TextArea1").change(function () {
        //    var value = document.getElementById("TextArea1").value;
        //    if (value == "") {                
        //        $(this).css('background-color', 'pink');
        //    }
            
        });

        //Author
        $("#Author").change(function () {
            var value = $(this).val();
            if (value == "") {
                $(this).css('background-color', 'pink');
            }
            
        });
                   
    });
</script>

@using (Html.BeginForm((string)ViewBag.FormAction, "GreenNews", FormMethod.Post, new { enctype = "multipart/form-data"}))
{
    @Html.ValidationSummary(true)
<fieldset>
    <p>
    <div id="news_title">
        <table>
            <tr>
                <td ><label class="lb">Title:</label></td>
            <td>
                @Html.TextBoxFor(model => model.Title, new { @class = "edit_title", @id = "Title" })
                @Html.ValidationMessageFor(model => model.Title)
                </td>
            </tr>
        </table>          
    </div>
    </p>

    <p>
    <div id="news_summary">
        <table>
            <tr>
                <td >
                    <label class="lb">Summary:</label>
                </td>
                <td>
                    <textarea class="summary" id="Summary" style="resize:none" name="str_summary">@Model.Summary</textarea>
                    @Html.ValidationMessageFor(model => model.Summary)          
                </td>
            </tr>
        </table>
     </div>
    </p>

    <p>
    <div id="news_picture">
        <table>
            <tr>
                <td ><label class="lb" >Picture:</label></td>
                <td>
                     <img src="@Model.Picture" class="picture" />
        <input type="text" name="picture" value="@Model.Picture" style="visibility:hidden"/> 
      
                </td>
            </tr>
           
        </table>
       
           
                 <div><input  type="file" name ="image" style="width: auto; margin-left:128px;" border="0"/></div> 
         
    </div>
    </p>

    <p>
    <div id="news_content">
        @*<table>
            <tr>
                <td ><label class="lb">Old Content:</label></td>
                <td>
        <textarea class="content" id="Content" style="resize:none" name="str_content">@Model.Content</textarea>
       @Html.ValidationMessageFor(model => model.Content)</td>
            </tr>
        </table>*@
        </div>
        <div>
            
        <div id="linkurl" title="Thêm Link">
         <fieldset class="ui-helper-reset">
                <label for="tab_title">Link URL: </label>
                <input type="text" name="tab_title" id="textlinkurl" value="" class="ui-widget-content ui-corner-all" />   
                <br />
                <label for="tab_title">More Description: </label>
                <input type="text" name="tab_title" id="text1linkurl" value="" class="ui-widget-content ui-corner-all" />          
         </fieldset>
        </div>

        <div id="imgurl" title="Thêm Hình">
             <fieldset class="ui-helper-reset">
                <label for="tab_title">URL Image:</label>
                <input type="text" name="tab_title" id="textimgurl" value="" class="ui-widget-content ui-corner-all" />         
            </fieldset>
        </div>

        <div id="TextQuote" title="Trích Nội Dung">
             <fieldset class="ui-helper-reset">
                <label for="tab_title">Quote:</label>
                <input type="text" name="tab_title" id="ContentQuote" value="" class="ui-widget-content ui-corner-all" />         
            </fieldset>
        </div>

        <div style="height:auto;width:100%;padding-right:0px">      
        <div id="XemThuNoiDung" class="content_section">

        </div>
            <div style="width: auto; margin-left:128px;" border="0" >
                <tr>
                   
                    
                        <button type="button" id="removeformat"> <img src="@Url.Content("~/Content/img/IconEdit/removeformat.gif")" /></button>
                        <button type="button" id="bold"> <img src="@Url.Content("~/Content/img/IconEdit/bold.gif")" /></button>
                        <button type="button" id="italic"> <img src="@Url.Content("~/Content/img/IconEdit/italic.gif")" /></button>
                        <button type="button" id="underline"> <img src="@Url.Content("~/Content/img/IconEdit/underline.gif")" /></button>
                        <button type="button" id="createlink"> <img src="@Url.Content("~/Content/img/IconEdit/createlink.gif")" /></button>
                        <button type="button" id="insertimage"> <img src="@Url.Content("~/Content/img/IconEdit/insertimage.gif")" /></button>
                        <button type="button" id="quote"> <img src="@Url.Content("~/Content/img/IconEdit/quote.gif")" /></button>
                        <input id="Br" type="button" value="<Br>" />
                       
                </tr>
                </div>
            <table style="width: auto;" border="0" >
                <tr>
                    
                    <td style="width:120px;"><label style="margin-right:10px;"><b>Content:</b></label></td>
                    <td >
                        <textarea id="TextArea1" cols="113" rows="10" name="S1" style="resize:none;">@Model.Content</textarea>
                        
                    </td>
                </tr>
                @* <tr>
                    <td >
                        <input id="XemThu" type="button" value="Preview" />
                        <input id="HuyXemThu" type="button" value="Cancel Preview"/></td>           
                </tr>*@
            </table>


        </div>
    </div>
    </p>

    <p>
    <div id="news_author">
        <table>
            <tr>
                <td >  <label class="lb">Author:</label></td>
                <td>
                  @Html.TextBoxFor(model => model.Author, new { @class = "author", @id = "Author" })
                  @Html.ValidationMessageFor(model => model.Author)</td>
            </tr>
        </table>
    </div>
    </p>

    <p>
    <div id="news_source">
        <table>
            <tr>
                <td > <label class="lb">Source:</label></td>
                <td>@Html.TextBoxFor(model => model.Source, new { @class = "source" })
                    @Html.ValidationMessageFor(model => model.Source)</td>
            </tr>
        </table>
    </div>
    </p>

    <p>
    <div id="news_imgComment">
        <table>
            <tr>
                <td >
                    <label class="lb">Picture comment:</label>
                </td>
                <td>
                           <textarea class="imgComment" id="ImageComment" style="resize:none" name="str_imgComment">@Model.ImageComment</textarea>
                    @Html.ValidationMessageFor(model => model.ImageComment)
                </td>
            </tr>
        </table>

    </div>
    </p>

    <p>
            <input type="submit" name="submitButton" value="Save" />
            <input type="submit" name="submitButton" value="Preview" />
            <input type="submit" name="submitButton" value="Cancel" />
        </p>
    <div class="clear"></div>
    </fieldset>
}
